Base32 is a development environment and compiler for dBase applications and OS/2 Warp. It works with a large range of dBase 3 and dBase 4 functions as well as providing additional, OS/2 specific functions.
The software will provide an environment to develop and test programs written in dBase as well as an option to compile stand alone 32 bit Presentation Manager applications for OS/2 WarpÖ
The program has been specifically written for OS/2 Warp and uses the full capabilities of this operating system to produce efficient executables from any dBase code.
This manual has been written assuming that the user has a good working knowledge of dBase and dBase functions so a detailed explanation of each function has not been included here. A full explanation of the Base32 OS/2 specific functions is included, however.
System requirements
Base32 requires OS/2 V3.0 ("Warp")or OS/2 V4.0 ("Merlin"). It should also operate correctly on OS/2 V2.1 but this has not been fully tested and cannot be assured.
System configuration should be a 486 PC with at least 8 MB Ram. The
software has been tested on a variety of platforms but we are unable to guarantee operation on every PC type.
Syntax abbreviations in this manual
Statement elements
<Numeric expression>
<Date expression>
<Character expression>
<Condition>
<Field list>
<Expression list>
Installing Base32
All the files necessary to run Base32 are included on the distribution disk.
To install Base32, put the distribution disk in your floppy drive and open up an OS/2 window. Select the drive (e.g.. A:) and type INSTALL then press enter.
The installation program will then prompt you for a target drive and directory and install the program files.
Starting Base32
The installation program will create a Base32 program Icon on your desktop to select and run the program.
The initial start up screen provides a number of options as follows:
Pull down menu
This contains a number of pull down menu options:
File
Commands
Locate
View
Exit
Each of the pull down menu sections are described in detail in the following chapters. Direct access to some of the functions is provided through the tool bar along the top of the screen. These Toolbar buttons are detailed in Chapter 6.
Chapter 2 - FILE menu
The file pull down menu provides the following options:
Use
The Use option selects the database file to be opened and used during the current session. At any time a new file can be opened using this command.
Create
This option allows you to create a database and save it with a specified name.
Modify structure
Enables you to modify the field structure of a database and save the changes
Close All
Close All will close all open database files.
Compile
Compile will compile a specified program. This option also provides the ability to generate a standalone executable 32 bit version of the program.
Do
The Do command will load and execute a specific program. It will also
optionally compile the program if it has not been compiled previously (or if has been modified since it was last compiled)
Learn
The Learn command captures a sequence of commands as you type then in. As well, changes can be made in the program which will recompile and execute.
Chapter 3 - Commands menu
The COMMANDS pull down menu contains the following options:
Pack
The Pack command will remove any records marked for deletion from the
current database file.
Zap
Zap will delete an entire database in one action
Reindex
Reindex will re build the current indexes for the current database
Delete
Delete allows you to select records for deletion based on conditions. (Refer to the DELETE statement in chapter 11)
Recall
This function is the opposite of the Delete command and untags records marked for deletion
Count
This function will count the number of records which match a specified set of conditions (refer to COUNT statement in chapter 11)
Chapter 4 - Locate and View menus
The LOCATE pull down menu contains the following options:
Go Top
This commands takes you to the first logical record in the database as determined by the current order of the database
Go Bottom
This commands takes you to the last logical record in the database as
determined by the current order of the database
Goto
Takes you directly to a specified record by number (the physical record order number)
Skip
Move forwards or backwards through the database by a specified number of records.
Seek
This function finds a specific record, using the current database order and where you specify a key value. For example, where a database of contact names is ordered by surname, then you would specify a surname to find.
Locate
Searches for a specific record which matches some particular condition.
The VIEW pull down menu contains the following options:
Browse
Browse opens the database up in a table view and allows you navigate around the database. You can also edit or append records to the database. It supports many other features which are detailed in the BROWSE statement explanation in chapter 11.
View
This option is the same as the Browse option but does not support editing of the database records or appending of new records
List
Enables you to list specified fields in a database, only showing those records which meet specified conditions. Refer to the LIST statement in chapter 11.
List Structure
Lists the structure of the database, detailing fields, field types, names and sizes.
Display
The same as the LIST command above with the addition of a pause between each page.
Display Structure
The same as the Display Structure command above with the addition of a pause between each page.
Chapter 5 - Exit menu
The EXIT pull down menu contains the following options:
Exit
Clicking on the exit option (or pressing F3) will close the program. As well, double clicking on the Base32 icon in the top left corner of the screen will similarly close down the program.
Escape
Escape will give you the option (through a YES/NO box) to terminate any currently executing command. Pressing the ESC key has the same effect.
Pause
This pause any currently executing command and prompts you to press any key to continue the execution of that command. Pressing CNTRL/S has the same effect.
Chapter 6 - Program navigation
1. Toolbar
The main start up screen includes a Toolbar with a series of buttons which provide single click access to a number of key functions and commands.
Figure 1 - Toolbar
The buttons provide access to the following program and command functions (corresponding to the equivalent options in the pull down menus):
Simply click on the appropriate button to select the function required
USE - the file load screen
DO- load and run a program
COMPILE - load and compile a program
ZAP - removes all current records from the database selected
PACK - removes records marked for deletion from the database
MODIFY - changes to the database structure
GO TOP - move to the first record in the database
GO BOTTOM - move to the last record in the database
GO TO - select a record to jump to
SEEK - find a search string in the database
PAUSE - pause the currently executing statement or command
ESCAPE - stop processing the current statement or command
2. Drop down list box
This entry box accepts dBase command statements and executes them. As
additional statements are entered, they will appear in the program list box below. The results of each command will be displayed in the client window which is the majority of screen area.
You are able to enter most OS/2 commands preceded by an exclamation mark (!). Any OS/2 commands which have output only are supported (e.g.. DIR, DEL, REN et).
The Drop down list box also has an expansion button on the far right of the command line box. Clicking on that will expand the command line entry box to show previously entered statements up to a total of 50 statements.
You can double click on any statement in the list box to re-execute the statement. Alternatively you can use the down arrow key to step down through the statements. When you find the one you want, pressing ENTER will re-execute the statement.
3. Status line
The status line at the bottom of the screen dynamically updates to show the status of the current operation and work area. Base32 supports up to 40 con-current work areas allowing you to have up to 40 databases open at the same time.
4. Scroll bars
The vertical and horizontal scroll bars allow you to move around on the screen. You can also use the conventional keys of Page UP, Page Down as well as the arrow keys when in BROWSE mode.
The scroll bars are only displayed if the Base32 main window size is reduced to anything less than its maximum size.
Chapter 7 - Producing stand alone executables
The COMPILE function gives you the option to produce a standalone
executable (.EXE) file from your original .PRG source file. This executable is a full 32 bit OS/2 application which will use the full multi tasking, multi threaded capabilities of OS/2 Warp.
The compiler process takes the original source code, compiles it and creates an EXE file. The executable file requires the supplied DLL files to operate.
Any number of Base32 generated executables can share the same DLL files as long as they are in the same directory or the DLL files are on the specified LIBPATH.
The resource file includes information about the licensed owner of the Base32 software being used to generate the executable. The distribution disks for Base32 are not copy protected and you are able to make backup disks as required for your own.
However, to protect the investment of registered purchasers of the software, the serial numbering of each copy is embedded in the resource file and will provide a "signature" in the executable produced.
Figure 2 - Compile screen
Chapter 8 - Programming considerations
Section A - Variable types supported
Base32 supports the four standard field variable types:
1. Character - up to a size of 65,533 characters
2. Numeric - floating point up to 19 digits which includes the decimal point where applicable. There must be at least one significant digit.
3. Date - standard eight characters which can be converted to any required date format using the SET DATE command
4. Logical - True/False represented by the values of 1 and 0
5. Memo - variable up to 65,535 characters
Section B - Record locking
Base32 supports multiple access of the same database files. The record locking schema used by Base32 is compatible with dBase IV. Some operations cause automatic locking such as appending records and packing databases. After these operations are complete you must unlock the work area by either a unlock or unlock all statement.
Section C - Arrays
Single or double dimension arrays are allowed in base32. To declare arrays for base32 use either the local or public statements as follows public array <array name>[<dimension> ] for a single dimension public array, or local array <array name>[<x dimension>, <y dimension>] to declare a double dimension local array.
Note that all array indexing begins at one and goes to the dimension size and not zero as in some other languages.
Assignments made to an array where the array element index is omitted will result in each element of the array being assigned with this value.
For example
MyArray = 0 will assign zero to every element in MyArray. This is useful for initializing arrays.
Section D - Parameter passing
All parameters in base23 are passed by value with the exception of array parameters which are passed by reference. That means the any assignments made to any parameter array elements in a procedure or function will overwrite the value in the original array element passed in as the parameter,all other parameter types will not affect the original variable.
Section E - Variable scoping
Variable scoping and declaration is dynamic in base32, in that when an expression is assigned to a new variable name, a local variable of this name is created and takes on the type of the expression being assigned. Using a new variable name in an expression for the first time will generate an error as unassigned variables cannot be read.
If an expression is assigned to an existing variable with a different type than the expression, the variable takes on the type of the expression.
If multiple instances of the of the same variable name exist, then variable a variable type priority is used when resolving the variable name to a variable instance. The following priority order is used to determine which instance is referenced.
? Database field
? local variable
? public variable
To create a local instance of a variable name when a public one already exists use the local declaration statement as follows
local <variable name>
This will create a local instance of a variable that will be accessed in priority over a public variable.
A local variable instance is destroyed when the procedure or function where it was declared is exited. All procedures and functions that are called from where the variable was created can access local variable.
Public variables are exist until the program or Base32 is exited.
Section F - Variable naming
Variable names unlike dBase can be up to 32 characters in length, All 32 characters of the name are used in identifying the variable. This may cause compatibility problems when re-compiling old dBase programs.
Section G - File naming conventions
Base32 uses the following file extensions to identify file types.
? .prg program file
? .dbf database file
? .ndx index file
? .res intermediate compiled program file.
Section H - Macros
Macros in base32 are treated differently than in dBase. As Base32 is a true compiled language some restrictions were placed on macros in order to make the run-time execution more efficient. The components in a the language that can be replaced to macros are as follows
? any expressions
? any filenames
? the on or off keyword in set to statements
However you cannot replace an entire statement with a macro variable.
For example
macrovar = ôonö
set lpt1 ¯ovar
is valid, however
macrovar=ölpt1 onö
set ¯ovar
is not valid.
Chapter 9 - Standard dBase functions supported
ABS
ACOS
ALIAS
ASC
ASIN
AT
ATAN
ATN2
BOF
CDOW
CEILING
CHR
CMONTH
COL
COS
CTOD
DATE
DAY
DBF
DELETED
DISKSPACE
DOW
DTOC
DTOR
DTOS
EOF
EXP
FCLOSE
FCREATE
FDATE
FEOF
FERROR
FFLUSH
FGETS
FIELD
FILE
FLD COUNT
FLOCK
FLOOR
FOPEN
FOUND
FPUTS
FREAD
FSEEK
FSIZE
FTIME
FV
FWRITE
HOME
INT
ISALPHA
ISBLANK
ISLOWER
ISUPPER
LEFT
LEN
LIKE
LOCK
LOG
LOWER
LTRIM
MAX
MIN
MOD
MONTH
NDX
OS
PAYMENT
PCOL
PIF
PROW
PV
RAND
RAT
RECCOUNT
RECNO
RECSIZE
REPLICATE
RIGHT
RLOCK
ROUND
RTOD
RTRIM
SELECT
SET
SIGN
SIN
SPACE
SQRT
STOD
STR
STUFF
SUBSTR
TAN
TIME
TRANSFORM
TRIM
TYPE
UPPER
VAL
VERSION
YEAR
Chapter 10 - Additional functions
Section A - Calling external OS/2 DLLs
LOAD_DLL
Description: This function enables you to load a DLL file specified by name. This returns a number which is used as the handle for this file in the LINK_FUNC function.
Parameters: <string which is the name of the DLL file to load>
Example: DLLHANDLE = LOAD_DLL ("MY.DLL") - this will load a DLL called MY.DLL and return a handle for it in the variable called DLLHANDLE.
LINK_FUNC
Description: This function allows you to get a handle to a user defined function in a previously loaded DLL (the DLL would have been previously loaded using the LOAD_DLL function).
Parameters: Requires two compulsory parameters -
(1) Must be type numeric and is the handle to the DLL file it is to be loaded from;
(2) Must be type character and is the name of the user defined function. Note that this parameter is case sensitive.
Example:
FUNCTHANDLE = LINK_FUNC (DLLHANDLE,"MYFUNCT")
CALL
Description: This function calls and executes the user defined function. It returns the value returned by the user defined function.
Parameters: This procedure has between one and six parameters.
Parameters are:
(1) Compulsory and must be type numeric and is the handle to the function as returned by LINK_FUNC;
(2) to (6) are optional parameters which are passed on to the user defined function
Description: Generates a dialogue box with Yes/NO buttons
The functions returns True or False with True = YES button
Parameters: Same as OKAY function
Example:
YESNO(" Exiting program","Are you sure?")
YESNOCAN
Description: Generates a dialogue box with three buttons - YES, NO and CANCEL
This function returns "1", "2" or "3" with 1 = YES button, 2 = No button and 3 = Cancel button or Escape key.
Parameters: Same as OKAY function
Example:
YESNOCAN( "Exit program", "Save data?")
SAVEDLG
Description: A dialogue which enables the user to select a name to save a file under. The functions returns the file name as a character string.
Parameters: Two parameters -
(1) The tile in the dialogue box;
(2) A skeleton for the file name or file extension
Example:
SAVEDLG( "Save document as?", "*.doc")
OPENDLG
Description: A dialogue which enables the user to select the name of a file to open. The functions returns the file name as a character string.
Parameters: Two parameters -
(1) The title in the dialogue box;
(2) A skeleton for the file name or file extension
Example:
OPENDLG( "Open which document?","*.doc")
FONTDLG
Description: This function provides a dialogue box for the user to select any pre loaded font. This routine returns a string containing the name of the font and the point size. The format of the return string can be fed directly into the SET FONT TO statement which will then change the font used in the client window.
The functions returns the font name and point size which can be used as direct input into Set Font To ie. Set Font To FONTDLG("Select a new font")
Parameters: Title of the dialogue box
Example:
FONTDLG("Select a new Font")
Section C - Clipper specific functions
ADIR
Description: This function enables the user to determine all the files which match a wildcard string.
Parameters: Accepts up to six parameters, the first of which is compulsory -
(1) Type string and is the file wildcard (e.g.. *.dbf); (2) to (6) are optional array parameters which are passed by reference.
(1) The first array parameter is where ADIR returns all the names of the files which match the skeleton.
(2) The second is where it returns all the file sizes.
(3) Where it returns the file date (last date written to);
(4) Where it returns the file last write time;
(5) Where it returns the file attributes
The function returns the number of files which match the skeleton.
There are a number of basic principles that apply to dBase statements that need to be appreciated to get the full benefit of Base32's capabilities.
The majority of statements follows a prescribed pattern of having a set of optional conditions - SCOPE, FOR and WHILE which can be put in any order. The conditions are optional unless specified otherwise in the individual statement explanations below.
SCOPE can be - ALL, REST or NEXT (n). Generally the default is ALL.
FOR can be - any logical expression e.g. a field content meeting a
prescribed value
WHILE can be - the search will continue as long as the WHILE condition evaluates to TRUE. As soon as it reaches a record which evaluates to FALSE, the search will stop.
Section A - General programming statements
Note that the examples included here are from the file EXAMPLE.PRG
included on the distribution disk and the example numbers correspond to those used in that program.
DELETE
Tags a record for deletion according to the Scope, For and While
conditions. Note that Delete without a Scope condition does NOT default to ALL but rather to the current record only (which will have been determined by previous commands such as Goto, Seek, Skip or similar).
* example 1
* this example deletes account 10 from the data base if it exists
use customer.dbf index customer.ndx, custname.ndx in 1
select customer
seek 10
if found()
delete
pack
endif
RECALL
Untags a record marked for deletion according to the Scope, For and While conditions. Note that Recall without a Scope condition does NOT default to ALL but rather to the current record only (which will have been determined by previous commands such as Goto, Seek, Skip or similar).
* example 2
* this example recalls all products with a non-zero price
use products.dbf index product.ndx, prodname.ndx in 2
select products
recall all for price <> 0
LOCATE
Locate is an alternative to Seek. Seek is an inflexible but fast search method whereas Locate allows considerably more flexibility to search under multiple conditions.
Locate will stop when it finds the first match in the database.
Combined with Continue, it will search until there are no further matches (Continue needs to be restated after each successful Locate to keep the search going).
If there is no Scope specified, the result will be ALL records. The FOR condition is compulsory as obviously the Locate would be meaningless without it.
* example 3
* this example puts Mr Smith into the customers data base with all
* of his details
select customer
seek 2
if .not. found()
append blank
replace account_no with 2 , ;
name with "Smith Mr. D", ;
address with "125 Pah Rd Auckland NZ", ;
balance with 0.0
endif
SUM
Adds up the contents of a list of fields. You have to specify to specify both the list of fields to Sum and also a list of variables to store the results of the Summing.
COUNT
Provides the total number of records which match a FOR condition. You can also save the result to a variable if required by adding a TO statement.
REPLACE
Used to replace the contents of a selection of fields with the value from the expression supplied. If there is no SCOPE or FOR statement, it defaults to the current record only.
With the Replace statement, you can specify any number of fields to be acted on as long as they are separated by commas.
APPEND BLANK
Adds one blank record into the database - all character fields will be spaces, all numeric fields will be zeroes and all date fields will be spaces, all logical fields will be a space (which will evaluate to False)
* example 4
* this example appends all products from the tempprod data base which
have
* non-space name
select products
append from tempprod.dbf for trim( name ) <> ""
APPEND FROM
Copies records from a named database to the current work area. You need to specify the database the records are to come from and the Scope, For and While conditions. It is important to note that the Scope, For and While conditions apply to the database you are copying records from NOT the database you are Appending to.
If the two databases have different structures, the information in the field names that match will be copied across. If the field types are different, automatic type conversion is provided.
You also have the option to Append From a specified character delimited text file e.g. a comma delimited text file which is the most common type.
Appending From a comma delimited file into an empty database is a good way to import from the comma delimited file type.
COPY TO
The same as Append except it is copying records to another database. If the database you are copying to does not exist, then it will be created with the same structure as the database you are copying from.
You can also copy to a character delimited field (such as a comma delimited file) to export data from the database to another file type.
COPY STRUCTURE TO
Creates an empty database with the same structure as the current database but does not copy any records to the new database.
COPY FILE TO
This statement will do a binary file copy and can be used to copy any file type. Functions exactly the same as the COPY command at the command prompt.
DISPLAY
Display with an expression list will display all matching records on the current output device. There is an automatic pause between each page full of records.
DISPLAY STRUCTURE
Displays the current database structure to the current output device with an automatic pause between pages.
LIST
Functions the same as DISPLAY except there is no pause between pages of records.
LIST STRUCTURE
Functions the same as display structure but without the pause between
pages of data.
SCAN
As well as using the standard Scope, For and While conditions you must then have at least one other command which is then performed for each record which passes the FOR condition. To finish the SCAN block of commands, you must end with an ENDSCAN statement.
INSERT BLANK [AFTER]
A database manipulation statement which inserts a blank record
immediately prior to the current record location. If the optional AFTER clause is used, the record will be inserted after the current record location.
CLOSE ALL
Closes all currently open databases and index files
EJECT
Generates a form feed on the printer
EJECT PAGE
Generates a page eject on the printer
RENAME..TO
Functions exactly the same as the RENAME function at an OS/2 command
prompt. Specify the current file name and the new file name.
ERASE
Functions exactly the same as the DEL command at an OS/2 command
prompt. Specify the file name to erase.
GO TOP [IN <ALIAS>]
Goes to the first logical record in the database as determined by the current order
GO BOTTOM [IN <ALIAS>]
Goes to the last logical record in the database as determined by the current order
GO or GOTO [IN <ALIAS>]
Interchangeable and will function exactly the same. With an optional
RECORD keyword followed by the record number as a numeric value will
take you to that specific record. The word RECORD can be left out and is often only included for readability of the source code. Thus GO 12 has the same effect as GO RECORD 12.
SKIP [IN <ALIAS>]
This function allows you to jump a specified number of records forward or backward in the database. Negative numbers determine the skip will be backward. If you do not specify a numeric value after the SKIP statement, the default will be one record.
SELECT
Allows you to specify which of the maximum of 40 work areas available in Base32 is the current work area. There are two ways to select a work area - by specifying the number of the work area or - by specifying the ALIAS of the database open in that area.
REINDEX
Rebuilds the indexes for the current work area
PACK
Removes all records tagged for deletion from the current work area
ZAP
Removes all records from the current work area regardless of the setting of the Delete tag.
INDEX ON
INDEX ON <expression> TO <index filename> [UNIQUE]
Allows you to create a new index file using the key expression supplied and optionally defining it as unique.
CLEAR SCREEN
Clears the current window (client area)
CLEAR GETS
Removes any current @GETS locations from the current window (client
area).
STORE TO
There are two ways to do an assignment e.g. X =Y. One is to use the store STATEMENT in the form STORE <expression> TO <variable name>.
The alternative is to use a simple statement such as <variable name> = <expression>
USE
Description: USE opens a database up into either the current or a specified work area.
Syntax: USE <file name> [INDEX <file name>[,<file name>]] [ ALIAS
(2) If the ALIAS name is not specified it will default to the name of the database without the path and extension.
(3) Under ORDER, the file name specifies which of the index files to use. If not specified it will default to the first of the index files in the Index list
Section B - Input and Output statements supported
READ
WAIT
@SAY
@EDIT
@FILL
@GET
@CLEAR
@SCROLL
@DOUBLE
@PANEL
@BOX
Section C - ON statement
Section D - Structured programming statements
FOR..NEXT Loop
FOR <variable name> = <numeric expression> TO <numeric expression>
[optional STEP]<numeric expression>
Program commands
NEXT
Note - If the STEP value is negative, then the starting value has to be greater than of equal to the terminating value.
LOOP
Also you can optionally use the LOOP statement which will go straight to the next iteration of the FOR statement. As well it can be used in DO..WHILE and REPEAT..UNTIL loops and with the SCAN statement.
EXIT
EXIT will immediately terminate the FOR loop. As well it can be used in DO..WHILE and REPEAT..UNTIL loops and with the SCAN statement.
DO..WHILE loop
DO Procedure name [WITH Parameter list]
DO WHILE <condition><statements>
ENDDO terminating statements for the DO..WHILE loop
Call a procedure and execute it and then return to the following line on meeting a RETURN statement. If the RETURN statement is left out, the program will not compile.
RETURN
Return followed by some optional expression. If RETURN is by itself, then it will return to the calling location in the program
REPEAT..UNTIL loop
Execute a set of statements until a condition is true
REPEAT <statements> UNTIL <conditional statement>
LOOP and EXIT are optional once again
DO..CASE loop
Allows you to conditionally execute some piece of code based upon
multiple conditions
DO CASE
CASE <condition>STATEMENT
CASE <condition>STATEMENT
etc.
[OTHERWISE]alternative commands
ENDCASE
IF..ELSE loop
A conditional branching type statement
IF <condition>
<commands>
[ELSEIF] <condition>
<commands>
[ELSE}
<commands>
ENDIF
ELSEIF is logic which provides many possible branches after the condition test.
Section C - BROWSE statement
Chapter 12 - Set Variable commands
SET CENTURY ON/OFF
This statement determines whether the output from the DATE function
displays the Century details. The variable has two possible values - ON or OFF. Setting to ON will display the century details and setting to OFF will suppress the display of the century details
Determines which index is used for the current view of the database. e.g.. SET ORDER TO 1 will set the order of the database to be the first index physical index list.
Set Order To 0 will sets the current order to the natural order of the database - the physical order of the records in the database.
SET INDEX TO
An alternative way to open up a list of indexes for a database or changing the current index for that database.
(Indexes are listed with commas between them if more than one)
You can also specify the default order for the database as part of the Set Index To statement. For example, Set Index To Name, Account, City Order City - this will specify the use of the three indexes Name, Account and City to be used with this database but the default order will be by City.
An alternative is to use the USE command with the list of indexes applicable as the last items e.g.. USE Customer.dbf Name , Account City. The database extension will default to .dbf if not specified as something else.
SET PROCEDURE TO
Specify a file name of another PRG file to include in the current PRG file. For example, Set Procedure To INVOICE.PRG will include the source file INVOICE.PRG at this point in the parent PRG file.
Note that directory and drive names can be included with the file name in any of these statements.
SET ALTERNATE TO
Specify a file to receive any output which is sent to the screen as well when Set Alternate On is specified.
SET ALTERNATE ON/OFF
Set Alternate On will start flow of screen output to the file. Set Alternate Off will stop flow of screen output to the file. Use of combinations of Set Alternate On and Set Alternate Off allows selected output to be directed to the file specified in Set Alternate To
SET ALTERNATE
This command without any extension (i.e.. without On or Off will close the file used up to that point for output re direction.
SET PRINTER TO
Directs the output to the screen to also go to a nominated printer device. Normally this is specified as LPT1 , LPT2 etc. but the printer device can also be a file
SET PRINTER ON/OFF
This statement will direct output to the specified printer device as
determined by the Set printer To statement.
SET PRINTER
This command without On or Off included will stop output to the printer and release the printer . Under OS/2, for non spooled printers this command releases the printer for other tasks or applications to use. For spooled printers under OS/2, the spooling finishes and printing will commence.
SET STATUS TO
The Set Status To statement is followed by an expression of type character. This expression is evaluated and then displayed on the status bar.
For example, Set Status To "Number of Customer is" + STR(RECCOUNT()).
Note: This function is not a standard dBase function and is specific to Base32.
SET STATUS ON/OFF
This command turns the status bar on or off at the bottom of the main
program window. This normally displays status information about the
program or whatever is set by the Set Status To command
SET TITLE TO
Defines what information is displayed in the title bar and the task list of currently running applications under OS/2.
Example - Set Title To "Customer maintenance Screen"
SET CONSOLE ON/OFF
Sets whether output goes to the screen. When used in conjunction with Set Printer On/Off, output can be directed to the Screen, Screen and Printer or Printer alone.
SET TALK ON/OFF
When executing typical database manipulation commands such as PACK,
DELETE, USE and others this statement will provide confirmation of
commands executed when Set talk On is used (or no confirmation if Set
Talk Off used) - Defaults to On
SET SAFETY ON/OFF
If Set Safety is ON and you attempt to delete or overwrite a file, you will be prompted to confirm that you wish to continue - "Are you sure" is prompted. - Defaults to On
SET CURRENCY TO
Specify the currency symbol - e.g.. "$" - up to 10 characters.
SET CURRENCY LEFT
Put the symbol before the number, right justified
SET CURRENCY RIGHT
Put the currency symbol after the number, left justified
SET DECIMALS TO
The system will display numbers to two decimal places by default when
displaying numbers. This statement allows the number of decimal places to be set to any number between 0 and 16.
SET DEVICE TO [SCREEN/PRINTER/FILE]
This enables you specify where the program output goes to. When FILE is the option, you have to specify a file name e.g.. Set Device To File Invoice.log
SET DIRECTORY TO
Specify a drive and directory to become the current drive and directory. You can specify one or the other, or both.
SET EXACT ON/OFF
Determines with a search (using the SEEK command ONLY) must find an
exact match to be successful as opposed to the search string being some part of the record. e.g.. If the search string is SMITH, then the Seek will only return entries where the name is exactly SMITH (including case sensitivity). If Set Exact Off is used, then entries such as SMITHSON, SMITHFIELD will also be found.
SET ESCAPE ON/OFF
Determines whether the escape key will function or not (produces a prompt as to whether you wish to continue or not). When Set Escape Off is used, the escape key is does not effect the operation of the program.
SET EXCLUSIVE ON/OFF
Determine whether a database is used exclusively or not. The effects of this are:
Exclusive on:
(1) If a databases has already been set to exclusive by another program or task, your USE statement will fail
(2) If you set it to exclusive on, then no other task or program can use it
If you want to modify the structure of a database, you MUST set it to
exclusive on.
SET DELETED ON/OFF
Determines whether records tagged for deletion are filtered out or not from processes such as displaying and listing. ON means records tagged for deletion are filtered out.
SET FILTER TO
This is related to the SET DELETED statement. Specify a logical expression which will evaluate to True or False. It will be evaluated for each record in the database. If it evaluated True for a record, that record will be visible.
SET FILTER TO LEFT( UPPER(Name),5) = "SMITH"
SET FILTER TO will remove the current filter
SET MARK TO
Determines the separator used in the Date display. Specify any character e.g.. Set Mark To "-"
SET NEAR ON/OFF
Similar to Set Exact. Effects the way a SEEK functions. Determines whether the Seek looks for the next closest match if an exact match cannot be found. if set to Off and no exact or partial match is found (depending whether Set Exact is On or Off), it will go to the bottom of the database.
(1) Exact and Near both OFF - if no partial match, will go to the bottom of the database
(2) Exact and Near both ON - if no exact match will go to the record location next to where you would have expected to find an exact match
(3) Exact ON and Near OFF - if no exact match it will go to the end of database
(4) Exact OFF and Near ON - if no partial match, it will go to the next logical record after where a partial match would have expected to have been.
SET POINT TO
Change the decimal point character e.g. 12.40 becomes 12,40
SET PRECISION TO
Determines the total number of characters the number takes up including the decimal point. if the number is larger than the Set Precision amount, the number will either be displayed as asterisks or in scientific notation.
e.g.. Set Precision To 12
SET SEPARATOR TO
Sets the character to be used between thousands in numbers e.g., 100,000 or 100.000
e.g.. "." defaults to comma
SET SPACE ON/OFF
When database is listed, do you have a space separator between fields
SET WRAP ON/OFF
List or display and record takes up more than one line - determines whether anything after 80 columns wraps onto next line or is ignored
Defaults to On
SET RELATION TO
Followed by expression; and then database or work area name e.g.. Set
Relation To Number into PLUHIST - this will set up a one to one relationship between the two databases.
It evaluates the expression for the first database and uses that as a value to seek for in the second database using its current index.
Ensure that information from two separate databases can be used to
display or work with and the correct matching of data from both will be maintained.
SET COLOR TO
This statement allows you to change the display characteristics on both color and monochrome displays. The statement recognises four areas of the display in terms of changing the color attributes. These are:
(1) Standard - which under DOS contains the Normal, Messages and Titles display areas
(2) Enhanced - which under DOS contains the Box, Highlight and
Information display areas
(3) Perimeter
(4) Background
Each of these areas of the display can be assigned different attributes to provide complex screen designs and variety.
In the Set Color To statement, attributes are assigned to each area
separated by commas. In each area it is possible to combine attributes to create new colors and combine base and new colors with effects. In this case the color and effect settings must be separated by a forward slash.
However, there are marked differences between the DOS environment that many dBase programs have been written for, and the Presentation
Manager environment under OS/2. Effectively, Base 32 allows color control over three distinct window areas - Foreground, Background and Perimeter.
However, to ensure compatibility, Base32 will accept program lines that conform to dBase standards for DOS. Where these environment variables are set elsewhere according to presentation Manager standards, the instructions will be compiled and have no effect.
For example, under Presentation Manager colors for dialog boxes, menu
bars, scroll bards, title bars, window borders etc are determined by OS/2 and are under the control of the User and not the program's control.
These are set up as part of the Scheme Palette setup in the System Setup folder on the Desktop.
The permissible base colors and effects are:
Colors:
W - white
G - green
N - black
B - dark blue
R - dark red
Effects:
U - underline
X - blank
+ - bright
Note that unlike dBase under DOS, where regardless of where you place it, the bright attribute only affects the foreground area - under Base32 this attribute can be set for any of the three window areas.
It is possible on a color display to combine color attributes to produce other colours as per the table below:
Combination colors
R/G = brown
R/B = dark pink/light red
G/B = dark cyan
R/G/B = pale grey
N+ = dark grey
R+ = red
G+ = light green
B+ = blue
R/G+ = yellow
R/B+ = pink
G/B+ = cyan
Note also that blinking and inverse video are not supported under
Presentation Manager's windows and these attributes in a source program will have no effect.
Example:
Set Color To W,N,R,B+*
SET FIELDS TO
Determines specific fields that you are interested in and suppresses the remaining fields - you can make visible the key fields you are interested in and ignore the rest. Supply list of fields separated by commas.
SET FIELDS ON/OFF
Turns on Set Fields T function or turns it off (back to all fields)
Can also create a derived field which is an additional field made up from an expression. e.g.. A field called customer has three balance fields - a new derived field could be Total Bal (Total Balance).
eg. Set Fields To Name, City, TotalBal = Bal1 + Bal2 +Bal3
You can also set individual fields to have specific attributes. E.g.. /R means the field is Read Only
Set Fields To Name /R
Chapter 13 - Configuration program
Base32 uses a dBase program called CONFIG.PRG to set the environment
variables for each Base32 session. CONFIG.PRG is any valid dBase
program and contains necessary environment set-up statements such as
fonts and language. Typically it will contain SET statements which establish the "look and feel" of the environment.
If any changes are made to CONFIG.PRG between Base32 sessions, the
program will automatically re compile the config program. If there have been no changes, it will run the previously compiled version of CONFIG.PRG.
The environment set-up by the configuration program remains unchanged
throughout the Base32 session.
If there is no CONFIG.PRG program present, the program will use current environment variables set on the PC when it loads.
Chapter 14 - Function errors
The system will produce error messages when it encounters an expression that does not conform to expected dBase rules or is unknown to the system.
Once again, these error messages assume a working knowledge of dBase
programming,
Function error list
0. "')' expected." ,
1. "Expression expected." ,
2. "Incompatible types" ,
3. "Procedure or main code too large." ,
4. "End of line expected." ,
5. "'(' expected." ,
6. "',' expected." ,
7. "ON or OFF expected." ,
8. "Invalid or unknown date format." ,
9. "Invalid or unsupported set type." ,
10. "'=' expected." ,
11. "':' in wrong place, or invalid drive specifier." ,
12. "'.' in wrong place, or invalid file extension." ,
13. "Invalid file path." ,
14. "Alias name expected." ,
15. "Work area number expected in range 1-40." ,
16. "Index file name expected." ,
17. "Invalid format for USE statement." ,
18. "Field name expected." ,
19. "Area number or alias name expected." ,
20. "WHILE , CASE or procedure name expected." ,
21. "No ENDDO found for DO WHILE." ,
22. "Unsupported or invalid statement." ,
23. "No ENDIF found for IF." ,
24. "No ENDCASE found for DO CASE." ,
25. "CASE expected." ,
26. "'[' expected." ,
27. "']' expected." ,
28. "Variable name expected." ,
29. "',' or ')' expected." ,
30. "\"%s\" is a procedure and not a function." ,
31. "\"%s\" is a function and not a procedure." ,
32. "You cannot nest procedures of functions." ,
33. "End of source found before RETURN." ,
34. "TO expected." ,
35. "More than one scope found in statement." ,
36. "More then one WHILE expression in statement." ,
37. "More then one FOR expression in statement." ,
38. "Invalid format in SUM statement." ,
39. "Invalid format in DELETE statement." ,
40. "Invalid format in RECALL statement." ,
41. "Invalid format in COUNT statement." ,
42. "Invalid format in REPLACE statement." ,
43. "WITH expected." ,
44. "Invalid format in LOCATE statement." ,
45. "Work area number must be from 1 to 40." ,
46. "')' , work area number or alias expected.",
47. "Invalid character in MACRO name." ,
48. "Error in type for ORDER." ,
49. "EOF found before ENDSCAN." ,
50. "No current scope for LOOP." ,
51. "No current scope for EXIT." ,
52. "Error in format of SCAN scope." ,
53. "File name or macro expected for index file." ,
54. "Error in format of LIST statement." ,
55. "Invalid type for negate." ,
56. "Invalid operand types for multiply or divide." ,
57. "Error in format of COPY TO statement." ,
58. "Error in format of APPEND statement." ,
59. "Cannot open \"%s\" source file." ,
60. "File name expected." ,
61. "No arguments for RUN." ,
62. "ON, OFF or TO expected." ,
63. "TO expected." ,
64. "INTO expected." ,
65. "Invalid drive specifier." ,
66. "SCREEN, PRINTER or FILE expected." ,
67. "Unresolved label \"%s\"." ,
68. "Invalid qualifier for CLEAR." ,
69. "Invalid format for @ SAY" ,
70. "Invalid format for @ GET" ,
71. "Invalid format for ?/??" ,
72. #ifdef COMPILER
73. "Invalid \"%s\" code file." ,
74. #else
75. "Invalid code/data in EXE file." ,
76. #endif
77. "Unable to open \"%s\" code file." ,
78. "MASTER expected." ,
79. "NEXT expected." ,
80. "Invalid scroll statement." ,
81. "ON, OFF, TO or OF expected." ,
82. "Invalid qualifier for ON statement." ,
83. "LINE expected." ,
84. "ALL expected." ,
85. "invalid format for BROWSE statement." ,
86. "only /R permitted here." ,
87. "compile cancelled by user." ,
88. "ENDSCAN expected." ,
89. "Invalid file name for create." ,
90. "%s does not exist." ,
91. "*** NULL ERROR message *** " ,
Chapter 15 - Compiler errors
The system will produce errors when trying to compile a dBase program if it finds an expression which does not conform to accepted dBase rules or encounters an expression which it does not recognise.
Compiler error list
0. "Data base with alias \"%s\" does not have field \"%s\"." ,
1. "No such data base alias as \"%s\"." ,
2. "Variable \"%s\" is unassigned." ,
3. "Divide by zero error." ,
4. "Cannot add a %s to a %s." ,
5. "Cannot subtract a %s from a %s." ,
6. "LOGICAL expression expected for .NOT. ." ,
7. "Cannot compare a %s with a %s." ,
8. "LOGICAL expression expected for .AND. ." ,
9. "LOGICAL expression expected for .OR. ." ,
10. "non numeric string parameter for STOD()." ,
11. "invalid date string for CTOD()." ,
12. "CHARACTER expression expected for USE." ,
13. "Invalid work area number, must be 1-20." ,
14. "Data base \"%s\" did not open successfully." ,
15. "No open data base in the current work area." ,
16. "LOGICAL expression expected for condition." ,
17. "[%-12lf] invalid array dimension for \"%s\"." ,
18. "NUMERIC value expected for array \"%s\"." ,
19. "[%-12lf,%-12lf] invalid array dimensions for
\"%s\"." ,
20. "NUMERIC, NUMERIC values expected for array \"%s\".",
21. "[%ld] bad array index for \"%s\"." ,
22. "\"%s\" is not a one dimensional array." ,
23. "NUMERIC value expected for index into \"%s\"." ,
24. "[%ld,%ld] bad array index for \"%s\"." ,
25. "\"%s\" is not a two dimensional array." ,
26. "NUMERIC, NUMERIC value expected for index
into \"%s\"." ,
27. "CHARACTER value expected for assignment to \"%s\"
field." ,
28. "DATE value expected for assignment to \"%s\"
field." ,
29. "NUMERIC value expected for assignment to
\"%s\" field." ,
30. "LOGICAL value expected for assignment to
\"%s\" field." ,
31. "<%s> Index file did not open successfully.",
32. "No tag selected for work area." ,
33. "Tag type differs from expression type." ,
34. "Index file error. please re-index." ,
35. "Invalid SET ORDER TO number." ,
36. "Invalid SET ORDER TO tag name." ,
37. "Invalid expression type for SET ORDER TO" ,
38. "Invalid expression type for ORDER expression" ,
39. "Error creating \"%s\" with \"%s\" expression." ,
40. "Maximum index files for area exceeded." ,
41. "Wrong number of parameters for \"%s\"" ,
42. "Have a %s value, expect a %s value for %s" ,
43. "Have %s,%s values, expect %s,%s values for %s" ,
44. "Have %s,%s,%s values, expect %s,%s,%s values for %s" ,
45. "Error while appending record in APPEND
FROM/COPY FROM." ,
46. "Cannot create \"%s\" successfully." ,
47. "Invalid type in macro for alias." ,
48. "Invalid file handle." ,
49. "No file handles available." ,
50. "Unable to start command processor." ,
51. "Cannot find %s." ,
52. "Invalid MODE for FSEEK()." ,
53. "invalid MODE for FOPEN() or FCREAT()." ,
54. "Can not open \"%s\"." ,
55. "Cannot initialise for filter and/or relation." ,
56. "Cannot make relation \"%s\"" ,
57. "Cannot set filter \"%s\"" ,
58. "Database \"%s\" already open or alias already used." ,
59. "Public variable \"%s\" already exists." ,
60. "Invalid opcode, call Tech Support." ,
61. "cannot read an unassigned variable." ,
62. "Macro \"%s\" is not a function or procedure." ,
63. "call stack overflow." ,
64. "working stack overflow." ,
65. "Data base \"%s\" must be opened exclusively for
operation." ,
66. "No valid scope or FOR condition set." ,
67. "Bad parameter for PICTURE, FUNCTION or
TRANSFORM()." ,
68. "two NUMERICS expected for @ SAY" ,
69. "\"%s\" is not a field in the current data base." ,